const path = require('path')
const resolve = (dir) => path.join(__dirname, dir)

const TransformPages = require('uni-read-pages')
const tfPages = new TransformPages({
  includes: ['path', 'name', 'meta', 'aliasPath'],
})
module.exports = {
  // 配置路径别名
  chainWebpack: (config) => {
    config.resolve.alias
      .set('@pages', resolve('pages'))
      .set('@scss', resolve('scss'))
      .set('@comp', resolve('components'))
  },
  configureWebpack: {
    plugins: [
      new tfPages.webpack.DefinePlugin({
        ROUTES: JSON.stringify(tfPages.routes),
      }),
    ],
  },
}
